package com.canomo.modules.inventory.entity;

import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import com.canomo.base.entity.FileInfo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 产品表
 * </p>
 *
 * @author xiaoj
 * @since 2018-07-14
 */
@TableName("inv_product")
public class Product extends Model<Product> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.ID_WORKER)
    @JsonSerialize(using=ToStringSerializer.class)
    private Long id;

    /**
     * 产品名称
     */
    private String name;

    private String remark;

    /**
     * 缩略图ID
     */
    @TableField("file_id")
    private Long fileId;

    /**
     * 成本
     */
    private BigDecimal cost;

    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 产品的所有人，默认为创建用户
     */
    @TableField("owner_id")
    private Long ownerId;

    /**
     * 创建用户
     */
    @TableField("create_user_id")
    private Long createUserId;

    /**
     * 创建时间
     */
    @TableField("create_date")
    private Date createDate;

    /**
     * 更新用户
     */
    @TableField("update_user_id")
    private Long updateUserId;

    /**
     * 更新时间
     */
    @TableField("update_date")
    private Date updateDate;

    /**
     * 产品状态
     */
    private String status;

    /**
     * 产品明细
     */
    @TableField(exist = false)
    private ProductDetail detail;

    /**
     * 重量
     */
    @TableField("weight")
    private BigDecimal weight;

    /**
     * 体积重
     */
    @TableField("volume_weight")
    private BigDecimal volumeWeight;

    /**
     * 利润
     */
    @TableField("profit")
    private BigDecimal profit;

    /**
     * 产品图片信息
     */
    @TableField(exist = false)
    private FileInfo fileInfo;

    /**
     * 产品缩略图地址
     */
    @TableField(exist = false)
    private String filePath;

    /**
     * 产品供货商列表
     */
    @TableField(exist = false)
    private List<ProductSupplier> suppliers;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }
    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    public Long getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(Long ownerId) {
        this.ownerId = ownerId;
    }
    public Long getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Long createUserId) {
        this.createUserId = createUserId;
    }
    public Date getCreateDate() {
        if (createDate == null) {
            return null;
        } else {
            return (Date)createDate.clone();
        }
    }

    public void setCreateDate(Date createDate) {
        if (createDate == null) {
            this.createDate = null;
        } else {
            this.createDate = (Date)createDate.clone();
        }
    }
    public Long getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Long updateUserId) {
        this.updateUserId = updateUserId;
    }
    public Date getUpdateDate() {
        if (this.updateDate == null) {
            return null;
        } else {
            return (Date)updateDate.clone();
        }
    }

    public void setUpdateDate(Date updateDate) {
        if (updateDate == null) {
            this.updateDate = null;
        } else {
            this.updateDate = (Date)updateDate.clone();
        }
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public ProductDetail getDetail() {
        return detail;
    }

    public void setDetail(ProductDetail detail) {
        this.detail = detail;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "Product{" +
        "id=" + id +
        ", name=" + name +
        ", remark=" + remark +
        ", fileId=" + fileId +
        ", cost=" + cost +
        ", price=" + price +
        ", ownerId=" + ownerId +
        ", createUserId=" + createUserId +
        ", createDate=" + createDate +
        ", updateUserId=" + updateUserId +
        ", updateDate=" + updateDate +
        ", status=" + status +
        "}";
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public BigDecimal getVolumeWeight() {
        return volumeWeight;
    }

    public void setVolumeWeight(BigDecimal volumeWeight) {
        this.volumeWeight = volumeWeight;
    }

    public BigDecimal getProfit() {
        return profit;
    }

    public void setProfit(BigDecimal profit) {
        this.profit = profit;
    }

    public FileInfo getFileInfo() {
        return fileInfo;
    }

    public void setFileInfo(FileInfo fileInfo) {
        this.fileInfo = fileInfo;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public List<ProductSupplier> getSuppliers() {
        return suppliers;
    }

    public void setSuppliers(List<ProductSupplier> suppliers) {
        this.suppliers = suppliers;
    }
}
